﻿using System;

namespace SharpSqlAnalyzer.nodes
{
	// Token: 0x02000329 RID: 809
	public class TOutputClause : TParseTreeNode
	{
		// Token: 0x170006B7 RID: 1719
		// (get) Token: 0x06001CFE RID: 7422 RVA: 0x003326F2 File Offset: 0x003308F2
		// (set) Token: 0x06001CFD RID: 7421 RVA: 0x003326E9 File Offset: 0x003308E9
		public virtual TResultColumnList SelectItemList2
		{
			get
			{
				return this.selectItemList2;
			}
			set
			{
				this.selectItemList2 = value;
			}
		}

		// Token: 0x170006B8 RID: 1720
		// (get) Token: 0x06001D00 RID: 7424 RVA: 0x00332703 File Offset: 0x00330903
		// (set) Token: 0x06001CFF RID: 7423 RVA: 0x003326FA File Offset: 0x003308FA
		public virtual TObjectNameList IntoColumnList
		{
			get
			{
				return this.intoColumnList;
			}
			set
			{
				this.intoColumnList = value;
			}
		}

		// Token: 0x06001D01 RID: 7425 RVA: 0x0033270B File Offset: 0x0033090B
		public override void init(object arg1, object arg2)
		{
			this.selectItemList = (TResultColumnList)arg1;
			if (arg2 != null)
			{
				this.intoTable = (TObjectName)arg2;
			}
		}

		// Token: 0x170006B9 RID: 1721
		// (get) Token: 0x06001D02 RID: 7426 RVA: 0x00332728 File Offset: 0x00330928
		// (set) Token: 0x06001D03 RID: 7427 RVA: 0x00332730 File Offset: 0x00330930
		public virtual TObjectName IntoTable
		{
			get
			{
				return this.intoTable;
			}
			set
			{
				this.intoTable = value;
			}
		}

		// Token: 0x170006BA RID: 1722
		// (get) Token: 0x06001D04 RID: 7428 RVA: 0x00332739 File Offset: 0x00330939
		// (set) Token: 0x06001D05 RID: 7429 RVA: 0x00332741 File Offset: 0x00330941
		public virtual TResultColumnList SelectItemList
		{
			get
			{
				return this.selectItemList;
			}
			set
			{
				this.selectItemList = value;
			}
		}

		// Token: 0x06001D06 RID: 7430 RVA: 0x0033274C File Offset: 0x0033094C
		public override void doParse(TCustomSqlStatement psql, ESqlClause plocation)
		{
			for (int i = 0; i < this.selectItemList.size(); i++)
			{
				TResultColumn resultColumn = this.selectItemList.getResultColumn(i);
				if (resultColumn.ToString().ToLower().StartsWith("deleted") || resultColumn.ToString().ToLower().StartsWith("inserted"))
				{
					if (resultColumn.FieldAttr != null)
					{
						resultColumn.FieldAttr.Location = ESqlClause.output;
						psql.tables.getTable(0).LinkedColumns.addObjectName(resultColumn.FieldAttr);
						resultColumn.FieldAttr.SourceTable = psql.tables.getTable(0);
					}
				}
				else
				{
					resultColumn.doParse(psql, ESqlClause.output);
				}
			}
			if (this.intoTable != null)
			{
				this.intoTable.ObjectType = 3;
				TTable ttable = new TTable();
				ttable.TableName = this.intoTable;
				ttable.EffectType = ETableEffectType.tetOutput;
				if (this.intoColumnList != null)
				{
					for (int j = 0; j < this.intoColumnList.size(); j++)
					{
						ttable.ObjectNameReferences.addObjectName(this.intoColumnList.getObjectName(j));
						this.intoColumnList.getObjectName(j).Location = ESqlClause.output;
						ttable.LinkedColumns.addObjectName(this.intoColumnList.getObjectName(j));
						this.intoColumnList.getObjectName(j).SourceTable = ttable;
					}
				}
				psql.tables.addTable(ttable);
			}
			if (this.selectItemList2 != null)
			{
				this.selectItemList2.doParse(psql, ESqlClause.output);
			}
		}

		// Token: 0x06001D07 RID: 7431 RVA: 0x003328C9 File Offset: 0x00330AC9
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06001D08 RID: 7432 RVA: 0x003328D9 File Offset: 0x00330AD9
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x04001A8E RID: 6798
		private TResultColumnList selectItemList;

		// Token: 0x04001A8F RID: 6799
		private TResultColumnList selectItemList2;

		// Token: 0x04001A90 RID: 6800
		private TObjectName intoTable;

		// Token: 0x04001A91 RID: 6801
		private TObjectNameList intoColumnList;
	}
}
